package com.canbot.u05.activity.vipguide;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import com.canbot.u05.MainApplication;
import com.canbot.u05.R;
import com.canbot.u05.activity.BaseActivityNoTitle;
import com.canbot.u05.socket.MsgSendUtils;
import com.canbot.u05.socket.MsgType;
import com.canbot.u05.utils.PathConst;


/**
 *贵宾无人脸
* */
public class VipNoFaceActivity extends BaseActivityNoTitle implements View.OnClickListener {

        private String isTask;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_vip_no_face);
                isTask=getIntent().getStringExtra("isTask");
                setViews();

                if(TextUtils.isEmpty(isTask)){
                        String[] voices = {"u05_wgbz_001.wav", "u05_wgbz_002.wav"};
                        int index = (int) (Math.random() * voices.length);
                        MsgSendUtils.sendStringMsg(MsgType.PLAY_SOUND, PathConst.VIP_GUIDE_DIR + voices[index]);
                }else{
                        MsgSendUtils.sendStringMsg(MsgType.PLAY_SOUND,PathConst.VIP_GUIDE_DIR + "u05_wrw_001.wav");
                }

        }

        private void setViews() {
                findViewById(R.id.face_regist1).setOnClickListener(this);
                findViewById(R.id.imageView_back).setOnClickListener(this);


                if (!TextUtils.isEmpty(isTask)) {
                        findViewById(R.id.RelativeLayout2).setVisibility(View.GONE);
                        findViewById(R.id.RelativeLayout).setVisibility(View.VISIBLE);
                }
        }

        @Override
        protected void onResume() {
                super.onResume();
        }

        @Override
        public void onClick(View view) {
                switch (view.getId()) {
                        case R.id.face_regist1:
                                Intent intent = new Intent();
                                intent.setClassName("com.unisrobot.faceregcognize", "com.unisrobot.faceregcognize.activity.FaceRegRegisterActivity");
                                if (intent != null) {
                                        startActivity(intent);
                                }
                                finish();
                                break;
                        case R.id.imageView_back:
                                if(TextUtils.isEmpty(isTask)){
                                        MainApplication.finishActivity(KnowVipActivity.class.getName());
                                }else{
                                        MainApplication.finishActivity(VipGuideTaskManageActivity.class.getName());
                                }
                                finish();
                                break;
                        default:
                                break;
                }
        }

        @Override
        protected void onPause() {
                super.onPause();
        }

        @Override
        protected void onDestroy() {
                super.onDestroy();
        }
}
